<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
		<script type="text/javascript" src="js/jquery-1.2.6.js"></script>
		<script type="text/javascript" src="js/chinese.js"></script>
		<link type="text/css" rel="stylesheet" href="style/style.css" />
		<title></title>
</head>
<body class="gui">

<div id="wrapper">
<div id="content">
	<div id="header">
<div id="logo">
<h1>Control Panel</h1>
</div>
<div id="mainMenu">
	<span><a id="nets" href="wan.htm"><img id="net" src="images/net_small.png" border="0"></a></span>
	<span><a id="cdrs" href="Dialing.htm"><img id="cdr" src="images/cdr_big.png" border="0"></a></span>
	<span><a id="manages" href="downlog.htm"><img id="manage" src="images/manage_small.png" border="0"></a></span>
</div>
<div id="menu">
 <div id="menuMain">
  <ul id="menuMainList">
  	<li><a href="Dialing.htm"><strong><script type="text/javascript">Capture(ivr_menu.basic)</script></strong></a></li>
   	<li><a href="extension.htm"><strong><script type="text/javascript">Capture(ivr_menu.extension_config)</script></strong></a></li>
   	<li><a href="trunk.htm"><strong><script type="text/javascript">Capture(ivr_menu.trunk_config)</script></strong></a></li>
   	<li class="current"><span><strong><script type="text/javascript">Capture(ivr_menu.tietrunk)</script></strong></span></a></li>
   	<li><a href="Analog_trunk.htm"><strong><script type="text/javascript">Capture(ivr_menu.system)</script></strong></a></li>
   	<li><a href="Systemcfg.htm"><strong><script type="text/javascript">Capture(ivr_menu.advanced)</script></strong></a></li>
  </ul>
 </div>
</div>
</div>
<div id="main">
<div id="contents">
<form name="filters" action="#" method="post" >
<fieldset>
<legend><script type="text/javascript">Capture(tietrunk_role.param9)</script></legend>
<div class="frame_tab_layer">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
<tr>
<td  class="frame_tab_right"><input type="radio" id="radio1" name="id673" value="2"/>
<label><script type="text/javascript">Capture(tietrunk_role.param5)</script></label></td>
</tr>
<tr>
<td class="frame_tab_right"><input type="radio" id="radio2" name="id673" value="1"/>
<label><script type="text/javascript">Capture(tietrunk_role.param7)</script></label></td>
</tr>
<tr id="tr153">
<td class="frame_tab_right"><label><script type="text/javascript">Capture(tietrunk_role.param14)</script></label>
<input type="text" id="id153" name="id153" size="30" maxlength="30" readonly="true"/></td>
</tr>
<tr id="tr_shenfen" style="display:none;">
<td class="frame_tab_right" ><font id="shenfen"></font></td>
</tr>
</table>
</div>
</fieldset>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
		<div class="submitFooter">
<script type="text/javascript">
//<![CDATA[
submitFooterButton(1,0,1);
//]]>
</script>
</div>
</form>
</div>
</div>
<br/>
<div id="helpContainer">
<div id="help">
<div><h2><img src="images/help_title.png" border="0"><script type="text/javascript">Capture(share.help)</script></h2></div>
<dl>
<dt class="term"><script type="text/javascript">Capture(tietrunk_role.title1)</script></dt>
<dd class="definition"><script type="text/javascript">Capture(tietrunk_manage.param3)</script><br/><script type="text/javascript">Capture(tietrunk_manage.param4)</script><br/><script type="text/javascript">Capture(tietrunk_manage.param5)</script><br/><script type="text/javascript">Capture(tietrunk_manage.param6) </script>
<br/><script type="text/javascript">Capture(tietrunk_manage.param7)</script></dd>
<dt class="term"><script type="text/javascript">Capture(tietrunk_role.title2)</script></dt>
<dd class="definition"><script type="text/javascript">Capture(tietrunk_role.param8)</script></dd>
<dt class="term"><script type="text/javascript">Capture(tietrunk_role.param14)</script></dt>
<dd class="definition"><script type="text/javascript">Capture(tietrunk_role.param15)</script>
	<script type="text/javascript">document.write("<input class=\"help_link\" type=\"button\" value=\"" +tietrunk_role.param16+ "\" onclick=\"window.location.href='domain.htm'\" />");</script>
	<script type="text/javascript">Capture(tietrunk_role.param17)</script></dd>
</dl>
</div>
</div>

<div id="floatKiller"></div>
<div id="statusInfo">

<div class="info"><span id="loginuser"></span></div>
<!--<div class="info"><script type="text/javascript">Capture(share.logintime)</script><span id="uptime"></span></div>-->
<div class="info"><button class="logout" onclick="reboot();"><img src="images/reboot.gif" border="0">&#160;<script type="text/javascript">Capture(tools.td10)</script></button><button class="logout" onclick="logout();"><img src="images/logout.gif" border="0">&#160;<script type="text/javascript">Capture(share.logout)</script></button></div>
</div>

</div>
</div>
<div id="lock_div">&nbsp; </div>
<div id="lock_div2">&nbsp;</div>
<div id="message_panel"><span id="mess">&nbsp;</span><br/>
  <br/>
  <img src="images/jd.gif"/>
</div>
<script type="text/javascript">
	setTimeout("height_div()",500);
	ivr_load();
</script>
<script type="text/javascript" src="lib.js"></script>
<script type="text/javascript" src="js/message_panel.js"></script>
<script type="text/javascript" src="js/tietrunk.js"></script>
<script type="text/javascript">
	function closetietrunk() {
	if(confirm(tietrunk_role.param1)) {
		var url="method=gw.config.set&id673=0&id34=&id153=&id154=&tmp="+Math.random();
		submitvalue(url,"5");
		return true;
	}else {
		return false;
	}
}

function submitrole() {
	if($("#radio1").attr("checked")) {
		var value153=$("#id153").val();
		if(value153=="") {
			//show_message("err",tietrunk_role.param2);
			alert(tietrunk_role.param2);
		}else {
			var url="method=gw.config.set&id673=2&id153="+value153+"&tmp="+Math.random();
			submitvalue(url,"2");
		}
	}else if($("#radio2").attr("checked")) {
		var value153=$("#id153").val();
		if(value153=="") {
			//show_message("err",tietrunk_role.param2);
			alert(tietrunk_role.param2);
		}else {
			var url="method=gw.config.set&id673=1&id153="+value153+"&tmp="+Math.random();
			submitvalue(url,"1");
		}
	}
}

function getrole() {
	var url="/xml?method=gw.config.get&id=476&id=673&id=4&id=2&id=5&id=158&id=83&id=643&id=153&id=154&tmp="+Math.random();
	$.get(url,function (data) {
		var stat=$(data).find('rsp').attr("stat");
		if(stat=="fail") {
			$(data).find('Error').each(function () {
				var code=$(this).attr('code');
				if(code==4) {
					//show_message("err",msg.cannotModify1);
					alert(msg.cannotModify1);
				}else if(code==5) {
					gotologin();
				}
			});
		}else {
			var value673='';
			var value4='';
			var value2='';
			var value153='';
			var value154='';
			var value83='';
			var value643='';
			var value5='';
			var value158='';
			var value476='';
			$(data).find("item").each(function () {
				if($(this).attr("id")=="673") {
					value673=$(this).attr("value");
				}else if($(this).attr("id")=="5") {
					value5=$(this).attr("value");
				}else if($(this).attr("id")=="4") {
					value4=$(this).attr("value");
				}else if($(this).attr("id")=="2") {
					value2=$(this).attr("value");
				}else if($(this).attr("id")=="476") {
					value476=$(this).attr("value");
				}else if($(this).attr("id")=="158") {
					value158=$(this).attr("value");
				}else if($(this).attr("id")=="153") {
					value153=$(this).attr("value");
				}else if($(this).attr("id")=="83") {
					value83=$(this).attr("value");
				}else if($(this).attr("id")=="643") {
					value643=$(this).attr("value");
				}else if($(this).attr("id")=="154") {
					value154=$(this).attr("value");
					$("[name=id154]").attr("value",value154);
				}if(value673=="2") {
					$("#radio1").attr("checked",true);
					$("#tr154").hide();
					$("#tr153").show();
					$("#shenfen").html('');
					$("#tr_shenfen").hide();
					var value153='';
					if(value643!=="") {
						value153=value643;
					}else if(value83!=="") {
						value153=value83;
					}else if(value158!=="") {
						value153=value158;
					}else if(value5&&value4=="off") {
						value153=value5;
					}else if(value2&&value2!=="Not Defined"&&value4=="on") {
						value153=value2;
					}else {
						value153=value5;
					}if(value476!=="5060") {
						value153=value153+":"+value476;
					}$("#id153").attr("value",value153);
				}else if(value673=="1") {
					$("#radio2").attr("checked",true);
					$("#tr154").show();
					$("#tr153").show();
					var value153='';
					if(value643!=="") {
						value153=value643;
					}else if(value83!=="") {
						value153=value83;
					}else if(value158!=="") {
						value153=value158;
					}else if(value5&&value4=="off") {
						value153=value5;
					}else if(value2&&value2!=="Not Defined"&&value4=="on") {
						value153=value2;
					}else {
						value153=value5;
					}if(value476!=="5060") {
						value153=value153+":"+value476;
					}$("#id153").attr("value",value153);
					str153=tietrunk_role.param3+value153+tietrunk_role.param4;
					$("#shenfen").html(str153);
					$("#tr_shenfen").show();
				}else {
					var value153='';
					if(value643!=="") {
						value153=value643;
					}else if(value83!=="") {
						value153=value83;
					}else if(value158!=="") {
						value153=value158;
					}else if(value5&&value4=="off") {
						value153=value5;
					}else if(value2&&value2!=="Not Defined"&&value4=="on") {
						value153=value2;
					}else {
						value153=value5;
					}if(value476!=="5060") {
						value153=value153+":"+value476;
					}$("#id153").attr("value",value153);
				}
			});
		}
	});
}

function check673() {
	if($("#radio1").attr("checked")) {
		$("#tr154").hide();
		$("#tr153").show();
		$("#shenfen").html('');
		$("#tr_shenfen").hide();
	}else {
		$("#tr154").show();
		$("#tr153").show();
		var value153=$("[name=id153]").val();
		str153=tietrunk_role.param3+value153+tietrunk_role.param4;
		$("#shenfen").html(str153);
		$("#tr_shenfen").show();
	}
}


	getrole();
	$("[name=closetietrunk]").click(function () {
		closetietrunk();
	});
	
	$("#radio1").click(function () {
		check673();
	});
	$("#radio2").click(function () {
		check673();
	});
	$("[name=submit]").click(function () {
		submitrole();
	});

</script>
</body>
</html>
